package com.imooc.utils;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.time.LocalDateTime;

//@Configuration
//@EnableScheduling   //开启定时任务
@Slf4j
public class MyTest {

    //添加一个任务，cron并且注明任务的运行表达式
    @Scheduled(cron = "*/5 * * * * ?")
    public void publicMsg(){
        log.warn("开始执行任务" + LocalDateTime.now());
    }
}
